namespace SimpleWebServices.Web.Routing
{
    using Xunit;

    public sealed class ExtensionFacts
    {
        [Fact]
        public void typedef()
        {
            Assert.True(new ObjectExpectations<Extension>()
                .DerivesFrom<ValueObject<Extension>>()
                .IsConcreteClass()
                .IsSealed()
                .HasDefaultConstructor()
                .IsNotDecorated()
                .Result);
        }

        [Fact]
        public void ctor()
        {
            Assert.NotNull(new Extension());
        }

        [Fact]
        public void ctor_string()
        {
            Assert.NotNull(new Extension("html"));
        }

        [Fact]
        public void prop_Value()
        {
            Assert.True(new PropertyExpectations(typeof(Extension).GetProperty("Value"))
                .DefaultValueIsNull()
                .Set(null)
                .Set(string.Empty)
                .Set("html")
                .IsNotDecorated()
                .Result);
        }

        [Fact]
        public void opImplicit_Extension_string()
        {
            Extension expected = new Extension("html");
            Extension actual = "html";

            Assert.Equal<Extension>(expected, actual);
        }

        [Fact]
        public void opImplicit_Extension_stringNull()
        {
            Extension expected = null;
            Extension actual = null as string;

            Assert.Equal<Extension>(expected, actual);
        }

        [Fact]
        public void opImplicit_string_Extension()
        {
            string expected = "html";
            string actual = new Extension(expected);

            Assert.Equal<string>(expected, actual);
        }

        [Fact]
        public void opImplicit_string_ExtensionNull()
        {
            string expected = null;
            string actual = null as Extension;

            Assert.Equal<string>(expected, actual);
        }

        [Fact]
        public void op_ToString()
        {
            string expected = "html";
            string actual = new Extension(expected).ToString();

            Assert.Equal<string>(expected, actual);
        }
    }
}